<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a="https://ajax4jsf.dev.java.net/ajax"
	xmlns:rich="http://richfaces.org/rich"
	template="../include/template.xhtml">

	<ui:define name="pageTitle">
		<h:outputText value="#{forumPlateAction.getPlateById().name}" />
	</ui:define>
	<ui:define name="logoTitle">
		<h:outputText value="讨论" />
	</ui:define>	

	<ui:define name="content">
		<style type="text/css">
<!--
.whitebgClass {
	background-color: #fff;
}

.otherbgClass {
	background-color: #f6fbff;
}

.inputClass {
	border: 1px solid #6699CC;
	width: 300px;
	margin-left: 4px;
}
-->
</style>
		<br />
		
		<h:outputText value="讨论区域" class="strong"></h:outputText>
		<rich:separator lineType="double" height="2px" />
		<rich:spacer width="30px"></rich:spacer>
		<s:div styleClass="right_center">
			<h:outputText value="" />
			<h:outputText value=" --> #{forumPlateAction.getPlateById().name}" />
		</s:div>

		<s:div styleClass="right_center">

			<rich:dataTable id="articlesList"
				onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
				onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
				value="#{forumPlateAction_articles}" var="varticle" width="100%">
				<rich:column>
					<f:facet name="header">
						<h:outputText value="发贴人" />
					</f:facet>
					<h:outputText value="#{varticle.sender.nickName}" />
				</rich:column>
				<rich:column>
					<f:facet name="header">
						<h:outputText value="话题" />
					</f:facet>
					<h:outputText value="#{varticle.name}" />
				</rich:column>
				<rich:column>
					<f:facet name="header">
						<h:outputText value="内容" />
					</f:facet>
					<h:outputText value="#{varticle.content}" />
				</rich:column>

				<rich:column>
					<f:facet name="header">
						<h:outputText value="发贴时间" />
					</f:facet>
					<h:outputText value="#{varticle.sendDate}">
						<s:convertDateTime pattern="yyyy-MM-dd-mm:ss" />
					</h:outputText>
				</rich:column>
			</rich:dataTable>

			<a:form id="articleForm">
				<rich:togglePanel switchType="ajax" stateOrder="first,second">
					<f:facet name="first">
						<s:div>
							<ui:include src="/include/plate/topMenu.xhtml"></ui:include>

						</s:div>
					</f:facet>
					<f:facet name="second">
						<s:div>
							<ui:include src="/include/plate/topMenu.xhtml"></ui:include>
							<h:panelGrid columns="2" rendered="#{loginUser != null}">
								<h:outputText value="话题:" />
								<h:inputText value="#{article.name}" class="inputClass" />
								<h:outputText value="内容:" />
								<h:inputTextarea value="#{article.content}" rows="7"
									class="inputClass" />
								<a:commandButton title="发表话题" value="提交" styleClass="gbutton"
									action="#{forumPlateAction.addArticle(article)}" />
							</h:panelGrid>

							<s:link value="您需要先登录才能继续进行操作。" styleClass="redAlert"
								view="/passport/login.xhtml" rendered="#{loginUser==null}"></s:link>
						</s:div>

					</f:facet>
				</rich:togglePanel>
			</a:form>
		</s:div>
	</ui:define>
</ui:composition>
